package com.asialjim.wechat.official;

import com.asialjim.wechat.apiservice.constant.WeChatConstants;
import com.asialjim.wechat.official.apiservice.OfficialMenuService;
import com.asialjim.wechat.spring.config.WeChatApiConfigProperties;
import com.asialjim.wechat.spring.config.WeChatConfig;
import com.asialjim.wechat.spring.config.WeChatMessageHandlerConfig;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import lombok.extern.slf4j.Slf4j;
import lombok.var;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Import;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
import java.util.Arrays;

/**
 * <h1><em>ASIAL JIM JAVA DOC</em></h1><hr/>
 * <h2>CLASS DESCRIPTION <i>[ NAME: Application ]</i></h2><strong>
 * <p> application
 * </strong><p><p><em>Copyright &copy; Asial Jim Co., LTD</em><hr/>
 *
 * @author Asial Jim &nbsp;&nbsp; <span>Email:<a href="mailto:asialjim@hotmail.com">asialjim@hotmail.com</a> &nbsp;&nbsp; <a href="asialjim@qq.com">asialjim@qq.com</a></span>
 * @version 1.0.0
 * @since 2021/3/11   &nbsp;&nbsp; JDK 8
 */
@Slf4j
@EnableSwagger2
@SpringBootApplication
@ComponentScan("com.asialjim.wechat")
public class Application {
    public static void main(String[] args) {
        try {
            var run = SpringApplication.run(Application.class, args);
            String[] beanNamesForType = run.getBeanNamesForType(BaseMapper.class);
            System.out.println(Arrays.asList(beanNamesForType));
        } catch (Throwable e){
            log.error("\r\n\terror :\r\n\t:{}",e.getMessage(),e);
        }
    }

    @Bean
    public WeChatApiConfigProperties properties(){
        WeChatApiConfigProperties properties = new WeChatApiConfigProperties();
        properties.setDomain(WeChatConstants.WeChatApiDomain.COMMON_DOMAIN);
        properties.setApplicationDomain("http://www.asialjim.com");
        return properties;
    }
}